import { useRoutes } from "react-router-dom";
import React from "react";
import { RouteObject } from "./interface";
import lazyLoad from "./utils/lazyLoad";
import LayoutPage from "../layout";
import IframeModules from './modules/iframe';
export const routerArray: RouteObject[] = [
    {
        path: "/",
        element: <LayoutPage />,
        meta: {
            title: "首页",
            isMenu: false,
        },
        children: [
            {
                path: "/xterm",
                element: lazyLoad(React.lazy(() => import("../pages/xterm"))),
                meta: {
                    title: "xterm",
                    isMenu: true,
                },
            },
            {
                path: "/calendar",
                element: lazyLoad(React.lazy(() => import("../pages/calendar"))),
                meta: {
                    title: "calendar",
                    isMenu: true,
                },
            },
            {
                path: "/label",
                element: lazyLoad(React.lazy(() => import("../pages/label"))),
                meta: {
                    title: "label",
                    isMenu: true,
                },
            },
            {
                path: "/three",
                element: lazyLoad(React.lazy(() => import("../pages/three"))),
                meta: {
                    title: "three",
                    isMenu: true,
                },
            },
            {
                path: "/dnd",
                element: lazyLoad(React.lazy(() => import("../pages/dndC"))),
                meta: {
                    title: "拖拽",
                    isMenu: true,
                },
            },
            {
                path: "/markdown",
                element: lazyLoad(React.lazy(() => import("../pages/markdown"))),
                meta: {
                    title: "markdown",
                    isMenu: true,
                },
            },
            {
                path: "/markdown-review",
                element: lazyLoad(React.lazy(() => import("../pages/markdown/MarkDownPreVie"))),
                meta: {
                    title:"markDown预览",
                    isMenu: false,
                },
            },
            {
                path: "/echarts",
                element: lazyLoad(React.lazy(() => import("../pages/brands"))),
                meta: {
                    title: "echarts",
                    isMenu: true,
                },
            },
            {
                path: "/earth",
                element: lazyLoad(React.lazy(() => import("../pages/earth"))),
                meta: {
                    title: "earth",
                    isMenu: true,
                },
            },
            {
                path: "/userinfo",
                element: lazyLoad(React.lazy(() => import("../pages/user/userinfo"))),
                meta: {
                    title: "userinfo",
                    isMenu: false,
                },
            },
            ...IframeModules,
            {
                path: "/user",
                element: lazyLoad(React.lazy(() => import("../pages/user/index"))),
                meta: {
                    title: "用户管理",
                    isMenu: true,
                    icon:'SettingOutlined',
                },
                children: [
                    {
                        path: "/user/list",
                        element: lazyLoad(
                            React.lazy(() => import("../pages/user/list/list")),
                        ),
                        meta: {
                            title: "用户中心",
                            isMenu: true,
                            icon:"UserOutlined"
                        },
                    },
                    {
                        path: "/user/file",
                        element: lazyLoad(
                            React.lazy(() => import("../pages/user/file/index")),
                        ),
                        meta: {
                            title: "文件管理",
                            isMenu: true,
                            icon:"ProfileOutlined"
                        },
                    },
                    {
                        path: "/user/role",
                        element: lazyLoad(
                            React.lazy(() => import("../pages/user/role/index")),
                        ),
                        meta: {
                            title: "角色管理",
                            isMenu: true,
                            icon:"UsergroupAddOutlined"
                        },
                    },
                    {
                        path: "/user/menu",
                        element: lazyLoad(
                            React.lazy(() => import("../pages/user/menu/index")),
                        ),
                        meta: {
                            title: "菜单管理",
                            isMenu: true,
                            icon:"MenuOutlined"
                        },
                    },
                ],
            },
        ],
    },

    {
        path: "/login",
        element: lazyLoad(React.lazy(() => import("../pages/login/index"))),
        meta: {
            title: "登录",
            isMenu: false,
        },
    },
];
const Router = () => {
    return useRoutes(routerArray);
};
export default Router;
